package com.ruge.seckill.error;

import com.ruge.core.exception.IError;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

/**
 * @author ruge.wu
 * @since 2022/1/30 12:51
 */
@NoArgsConstructor
@AllArgsConstructor
public enum SeckillError implements IError {
    THERE_IS_NO_RUSH_BUYING_ACTIVITY_FOR_COUPONS("0001", "优惠券无抢购活动"),
    RUSH_PURCHASE_HAS_NOT_STARTED("0002", "抢购未开始"),
    THE_RUSH_PURCHASE_HAS_ENDED("0003", "抢购已结束"),
    THE_COUPON_HAS_BEEN_SOLD_OUT("0004", "优惠券已售罄"),
    USERS_DO_NOT_NEED_TO_BUY_AGAIN("0004", "该用户已抢到该代金券，无需再抢"),
    THE_COUPON_ALREADY_HAS_A_SNAP_UP_ACTIVITY("0005", "该券已经拥有了抢购活动，无需新增"),
    ;

    private String errorCode;
    private String errorMessage;
    private static final String NAME_SPACE = "RUGE-SECKILL-ERROR";

    @Override
    public String getNamespace() {
        return NAME_SPACE;
    }

    @Override
    public String getErrorCode() {
        return NAME_SPACE + "." + errorCode;
    }

    @Override
    public String getErrorMessage() {
        return errorMessage;
    }
}
